using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using MonoTouch.Foundation;
using MonoTouch.UIKit;
using CoachingOrganizer.Logic.Models.Tools.MoneyCalculation;

namespace CoachingOrganizer.iOS.Controllers.Tools.MoneyCalculation
{
    [Register("SpentsMoneyCalculationDetailsViewController")]
    public class SpentsMoneyCalculationDetailsViewController : UITabBarController
    {
        private readonly MoneyCalculationModel _model;

        public MoneyCalculationModel Model
        {
            get { return _model; }
        }

        public SpentsMoneyCalculationDetailsViewController(IntPtr handle)
            : base(handle)
        {
            _model = ((MoneyCalculationDetailsViewController)ParentViewController).Model;
        }

        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            InitModel();
        }

        private async void InitModel()
        {
            using (System.Threading.CancellationTokenSource cancellation = new System.Threading.CancellationTokenSource())
                await _model.Incomes.LoadMoneyFlowItemsAsync(cancellation.Token);
        }
    }
}